<%inherit file="base.html"/>

<%def name="head()">
<script>
    function deleteOstype(ostype_id)
    {
        if(confirm("确认删除吗？"))
        {
            window.location.href = "/ostype/delete?ostype_id="+ostype_id;
        }
    }
</script>
</%def>

<%def name="body()">
<section class="content">
    <div class="box box-primary">
        <div class="box-header">
            <i class="fa fa-sitemap"></i>
            <h3 class="box-title">设备类型列表</h3>
        </div>
        <div class="box-body">
            <div class="container">
                % if permit.match(current_user.username,'/ostype/add'):
                <div class="pull-right bottom10">
                     <a href="/ostype/add" class="btn btn-sm btn-default">增加设备类型信息</a>
                </div>
                % endif

                <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>设备类型</th>
                            <th>操作系统</th>
                            <th>匹配规则</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        % for item in page_data.result:
                            <tr>
                                <td>${item.dev_type}</td>
                                <td>${item.os_name}</td>
                                <td>${item.match_rule}</td>
                                <td>
                                    % if permit.match(current_user.username,'/ostype/update'):
                                    <a class="opt-btn btn-default" href="/ostype/update?ostype_id=${item.id}">修改</a>
                                    % endif
                                    % if permit.match(current_user.username,'/ostype/delete'):
                                    <a class="opt-btn btn-default" href="javascript:deleteOstype('${item.id}')">删除</a>
                                    % endif
                                </td>
                            </tr>
                        % endfor
                    </tbody>
                </table>
                ${page_data.render()}
            </div>
        </div>
    </div>
</section>
</%def>